#include <stdio.h>
int main(int argc, char const *argv[])
{
    int x = 5, y = 6;
    (x > 5) && (y++);
    printf("x=%d,y=%d\n", x, y); // 逻辑与短路特性
    (x <= 5) || (y++);
    printf("x=%d,y=%d\n", x, y); // 逻辑或短路特性

    x = 5, y = 18;  //进行与运算
    int ret = (x >= 5) && (y < 20);
    printf("1:ret=%d\n", ret);
    ret = ((x + 1) >= 0) && (y < 17);
    printf("2:ret=%d\n", ret);
    ret = ((x - 8) >= 0) && (y == 18);
    printf("3:ret=%d\n", ret);
    ret = ((x - 5) > 0) && (y != 18);
    printf("4:ret=%d\n", ret);

    // 进行或运算
    ret = ((x >= 5)) || (y < 20);
    printf("5:ret=%d\n", ret);
    ret = ((x + 1) >= 0) || (y < 17);
    printf("6:ret=%d\n", ret);
    ret = ((x - 8) >= 0) || (y == 18);
    printf("7:ret=%d\n", ret);
    ret = ((x - 5) >= 0) || (y != 18);
    printf("8:ret=%d", ret);

    return 0;
}
